package com.bianxingji.api;

import com.bianxingji.dto.BxjMovieDto;
import com.bianxingji.model.PageResult;
import com.bianxingji.model.RestResponse;
import com.bianxingji.service.BxjMovieService;
import com.bianxingji.vo.BxjMovieBaseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author: 24478
 * @create: 2024-12-04 16:37
 **/

@Api(tags = "电影接口")
@RestController
@RequestMapping("/movie")
public class BxjMovieController {

    @Autowired
    private BxjMovieService bxjMovieService;

    @ApiOperation("推荐花絮电影基本信息")
    @GetMapping("/getCommentList")
    public RestResponse<List<BxjMovieBaseVo>> getCommentList(){
        return  RestResponse.success(bxjMovieService.getCommentList());
    }

    @ApiOperation("推荐花絮电影基本信息")
    @PostMapping("/page")
    public RestResponse<PageResult<BxjMovieDto>> getPage(@RequestBody Map<String,Object> map){
        return  RestResponse.success(bxjMovieService.getPage(map));
    }

    @ApiOperation("新增或者修改电影")
    @PostMapping("/change")
    public RestResponse<Boolean> change(@RequestBody Map<String,Object> map){
        return  RestResponse.success(bxjMovieService.change(map));
    }

    @ApiOperation("修改状态")
    @GetMapping("/updateStatus")
    public RestResponse updateStatus(String id, Integer status){
        return  RestResponse.success(bxjMovieService.updateStatus(id,status));
    }

    @ApiOperation("删除")
    @DeleteMapping("/delete")
    public RestResponse deleteMovie(@RequestBody BxjMovieDto bxjMovieDto){
        return  RestResponse.success(bxjMovieService.deleteMovie(bxjMovieDto));
    }

    @ApiOperation("批量删除")
    @DeleteMapping("/deleteBatch")
    public RestResponse deleteBatch(@RequestBody String [] ids){
        return  RestResponse.success(bxjMovieService.deleteBatch(ids));
    }
}
